<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>奇偶数练习</title>
		<style>
			#odd,#even{
				width:350px;
				height: 350px;
				border: 2px solid black;
				margin: 10px 10px;
				float: left;
				font-size: 20px;
				background-color: royalblue;
				/*超出边框加滚动条*/
				overflow: auto ;
			}
		</style>
	</head>
	<body>
		<div id="odd"></div>
		<div id="even"></div>
		<script>
		//获取显示区域
		  var left=document.getElementById("odd");
		  var right=document.getElementById("even");
		  //定义两个字符串拼接数字
		  var oddstr="";
		  var evenstr="";
		  //alert(rightstr);
		  //alert(leftstr);
		  for(var i=1;i<=100;i++)
		  {
		  	//奇数
		  	if(i%2 != 0)
		  	{
		  		oddstr = oddstr + i + " ";
		  	}
		  	//偶数
		  	else{
		  		evenstr = evenstr + i + " ";
		  	} 	
		  }
		  left.innerHTML = oddstr;
		  right.innerHTML = evenstr;
		</script>
	</body>
</html>
